﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Home
{
	public partial class fRoute : Form
	{
		Route item;
		public fRoute(Route r)
		{
			item = r;
			InitializeComponent();
			Fill();
			
		}
		void Fill()
		{
			eName.Text = item.Name;
			eStart.Value = item.Start;
			eEnd.Value = item.End;

			dataGridView1.Rows.Clear();
			foreach (var r in item.Entries)
				dataGridView1.Rows.Add(r.time, r.name, r.amount.ToString("0.00"), r.iscompany, r.fuelprice == -1 ? "" : r.fuelprice.ToString("0.000"));
			FillDist();
		}
		void FillDist()
		{
			dataGridView2.Rows.Clear();
			foreach (var l in item.Lengths)
				dataGridView2.Rows.Add(l.Key, l.Value);
			dataGridView2.Rows.Add(item.SiteDays + " days x " + item.SiteDist, item.Distance_Daily);
		}
	}
}
